<?php
namespace app\wap\controller;

class Index extends Base
{
    public function index()
    {
        return $this->_fetchHtml('index');
    }

    public function zhibo(){
        $doclist = _db('livedata',[] , false)->order('ts desc')->paginate(20);
        return $this->fetchHtml('zhibo',[
            'web_title' => 'NBA直播|足球直播|体育直播|比赛高清直播 - 看球吧',
            'web_kw' => 'NBA直播,足球直播,体育直播,比赛直播',
            'web_desc' => '直播吧提供NBA直播,足球直播,体育直播,比赛高清直播',
            'doclist' => $doclist
        ]);
    }

    public function info(){
        $id = input('id');
        $id = intval($id);
        if($id <= 0){
            $this->redirect('index');
            exit;
        }
        $info =_db('livedata' , [] , false)->where('id' , $id)->find();
        $pre =_db('livedata' , [] , false)->where('id' ,'>', $info['id'])->order('ts desc')->find();
        $next =_db('livedata' , [] , false)->where('id' ,'<', $info['id'])->order('ts desc')->find();
        $aboutlist = _db('livedata' , [] , false)->where('ts' , '>' , time())->limit(10)->select();
        $wt = date("Y年m月d日 H:i" , $info['ts']) . ' ' . $info['cup_title'] .' '.$info['ha'] .' 视频直播-比赛直播 - 看球吧';
        return $this->fetchHtml('info',[
            'web_title' => $wt,
            'web_kw' => $wt,
            'web_desc' => $wt,
            'info' => $info,
            'pre' => $pre,
            'next' => $next,
            'aboutlist' => $aboutlist
        ]);
    }

    public function cr(){
        $category = _db('category',[], false)->where('id' , 110)->find();
        $single = _db('article_single')->where('category_id' , 110)->find();
        return $this->fetchHtml('cr' , [
            'web_title'=> $category['web_title'],
            'web_kw'   => $category['web_kw'],
            'web_desc' => $category['web_desc'],
            'category' => $category,
            'single'   => $single
        ]); 
    }

    public function contact(){
        $category = _db('category',[], false)->where('id' , 111)->find();
        $single = _db('article_single')->where('category_id' , 111)->find();
        return $this->fetchHtml('cr' , [
            'web_title'=> $category['web_title'],
            'web_kw'   => $category['web_kw'],
            'web_desc' => $category['web_desc'],
            'category' => $category,
            'single'   => $single
        ]); 
    }

    public function sitemap(){
        $doclist = _db('article_doc' , [] , false)->order('create_time desc')->paginate(50);
        return $this->fetchHtml('sitemap' , [
            'web_title'=> '网站地图 - 看球吧',
            'web_kw'   => '网站地图 - 看球吧',
            'web_desc' => '网站地图 - 看球吧',
            'doclist'  => $doclist
        ]); 
    }
}
